<template>
	<div id="patient-detail">
		<div class="page-header">
  		患者详情
  		</div>
		<!--<collapse-table 
			:model="userInfo"
		>	
			<el-button type="primary" icon="edit" slot="action" style="float:right" @click.stop=""></el-button>
			<div class="head" slot="head">
				<img :src="require('../img/logo-mini.png')"/>
			</div>
		</collapse-table>
		<collapse-table
			:model="service_overview"	
		></collapse-table>-->
		<el-row :gutter="24">
		  <el-col :xs="24" :sm="24" :md="24" :lg="8" >
		  	<div class="userInfo">
				<div class="header" v-if="headSrc">
					<img :src="headSrc"/>
				</div>
				<!--<wt-model-info  v-on:input="handleLoad" :params-data="paramsData"  :allow-edit="hasEditPermission" :auto-load="true" :model="userInfo"  ></wt-model-info>-->
				<patient-info-message
				:params-data="paramsData"
				v-on:src="handleLoad"
				></patient-info-message>
			</div>
		  <div class="grid-content"></div></el-col>
		  <el-col :xs="24" :sm="24" :md="24" :lg="16" >
		  	<div class="userInfo">
				<div class="service-box">
					患者评估表:{{count}}
				</div>
				<wt-model-table
						:model="service"
						:params-data="params"
						:show-pagination="false"
						:allow-add="false"
						:allow-edit="false"
						:allow-remove="false"
						:auto-load="true"
						v-on:table-data = "tableData">
						<el-table-column label="操作" min-width="80" fixed="right">
							<template scope="scope">
								<router-link :to="{name:'service-detail',query:{user_id:user_id.toString(),service_compose_id:scope.row.sc_id,}}">
									<el-button icon="document" @click="" size="small">详情</el-button>
								</router-link>
							</template>
						</el-table-column>
					</wt-model-table>
			</div>
		  <div class="grid-content"></div></el-col>
		</el-row>		
	</div>
</template>

<script>
	/*import collapse from '../components/collapse'*/
	// import userInfo_model from '../model/patient-Info'
	// import info from 'winged/components/wt-model-info'
	import Permission from 'winged/utils/wt-permission';
	import service_overview_model from '../model/service-overview'
	import tableForm from 'winged/components/wt-model-table'
	import oss from '../utils/parseOSS.js'
	import request from 'winged/utils/axios'
	import permission from 'winged/utils/wt-permission'
	import patientService from '../model/patient-service'
	import patientMessage from '../components/patient-info-message'
	
	import process from '../components/process'
	export default {
		components:{
			[[tableForm.name]]:tableForm,
			// [[info.name]]:info,
			[[patientMessage.name]]:patientMessage,
			process,
		},
		data(){
			return {
				// userInfo:userInfo_model,
				service_overview:service_overview_model,
				service:patientService,
				paramsData: {
					user_id:"",
					patient_id:""
				},
				hasEditPermission: false,//Permission.checkPermission('patient-case-add') && Permission.canEditCase(this.caseData.properties.creator_doctor_grade, this.caseData.creator_doctor_id),/*传入病例等级/病例创建者等级*/
				headSrc:'',//头像图片
				count:0,//服务单数量
				params:{
					patient_id:""
				},
				user_id: LA.userInfo['info.id']
			}
		},
		mounted(){
		},
		methods:{
			handleLoad(data){
				this.headSrc = data.photo_path;
			},
			tableData(data){
				if(data){
					this.count = data.length
				}				
			}
			
		},
		created(){
			this.paramsData.user_id = permission.getCurrentUserId();
			this.paramsData.patient_id = this.$route.query.patient_id;
			this.params.patient_id = this.$route.query.patient_id;
			
		}
	}
</script>

<style lang='less'>
/*边框颜色*/
@border-color:#d1dbe5;
#patient-detail{
	.userInfo{
		background-color:#fefefe;
		.header{
			text-align: center;
			padding:8px 0;
			border:solid 1px @border-color;
			border-bottom:none;
		}
		.service-box{
			border:solid 1px @border-color;
			border-bottom:none;
			padding:10px;
		}	
	}
	.el-table--fit{
		border-right:1px solid #dfe6ec
	}
}
</style>